package com.theo.service.impl;

import com.theo.entity.NewsInfo;
import com.theo.mapper.NewsInfoMapper;
import com.theo.service.NewsInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 方涛
 * @since 2021-02-02
 */
@Service
public class NewsInfoServiceImpl extends ServiceImpl<NewsInfoMapper, NewsInfo> implements NewsInfoService {

    @Autowired
    private NewsInfoMapper newsInfoMapper;
    @Override
    public int saveNewsInfo(NewsInfo newsInfo) {
        return newsInfoMapper.insert(newsInfo);
    }

    @Override
    public int deleteNewsInfo(Integer id) {
        return newsInfoMapper.deleteById(id);
    }

    @Override
    public int updateNewsInfo(NewsInfo newsInfo) {
        return newsInfoMapper.updateById(newsInfo);
    }

    @Override
    public List<NewsInfo> queryAllNewsInfo() {
        return newsInfoMapper.queryAllNewsInfo();
    }

    @Override
    public NewsInfo queryNewsInfoById(Integer id) {
        return newsInfoMapper.selectById(id);
    }

    @Override
    public List<NewsInfo> findAllByDate(String date) {
        return newsInfoMapper.findAllByDate(date);
    }
}
